const rp = require('request-promise-native');
const util = require('../util');

//https://api.weixin.qq.com/cgi-bin/material/batchget_material?access_token=ACCESS_TOKEN
const run = async ()=>{
  let access = await util.getAccess();
  let options = {
    method: 'POST',
    uri: 'https://api.weixin.qq.com/datacube/getarticlesummary?access_token=' + access,
    // formData: {
    //   type: 'news',
    //   offset: 0,
    //   count: 20
    // }
    formData: {
      begin_date: '2017-07-01',
      end_date: '2017-07-02',
    }
  };
  try{
    let res = await rp(options);
    console.log(res);
  }catch(e){
    console.log('error ------> ', e);
  }
};

run();